﻿
IF (EXISTS(SELECT id from sysobjects where id=object_id('usp_UpdateCandidate')))
	DROP PROCEDURE [dbo].[usp_UpdateCandidate]
GO

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go




create procedure usp_UpdateCandidate
@CandidateId as int,
@DistrictId as nvarchar(50),
@PanchayatId as nvarchar(50)
@WardId  as nvarchar(50),
@VoterId  as nvarchar(50),
@Party as nvarchar(50),
@Symbol as nvarchar(50),
@ElectionId as nvarchar(50)
as

if (@Symbol='')

update TblCandidate 
set
DistrictId = @DistrictId,
PanchayatId = @PanchayatId,
WardId = @WardId,
Party = @Party,
ElectionId = @ElectionId
where 
CandidateId=@CandidateId

else


update TblCandidate 
set
DistrictId = @DistrictId,
PanchayatId = @PanchayatId,
WardId = @WardId,
Party = @Party,
Symbol = @Symbol,
ElectionId = @ElectionId
where 
CandidateId=@CandidateId
